package com.aspose.cells;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class ShapeCollection extends CollectionBase {
   private WorksheetCollection b;
   private Worksheet c;
   private Object d;
   private int e;
   private zqy f;
   private ArrayList g = null;

   ArrayList a() {
      return this.g;
   }

   void a(ArrayList var1) {
      this.g = var1;
   }

   ShapeCollection(WorksheetCollection sheets, Worksheet sheet, zra dggContainer, Object parent, int dgId) {
      this.d = parent;
      this.b = sheets;
      this.c = sheet;
      if (dgId == -1) {
         this.f = dggContainer.a(this, dggContainer);
      } else {
         this.f = new zqy(this, dggContainer, dgId);
      }

      this.e = 0;
   }

   static int a(int var0) {
      switch(var0) {
      case 1:
         return 2;
      case 3:
         return 3;
      case 19:
         return 4;
      default:
         return 30;
      }
   }

   void b() {
      Iterator var1 = this.iterator();

      while(var1.hasNext()) {
         Shape var2 = (Shape)var1.next();
         switch(var2.getMsoDrawingType()) {
         case 2:
            this.a((zbtz)((RectangleShape)var2).ab(), 0);
            break;
         case 3:
            this.a((zbtz)((Oval)var2).ab(), 0);
            break;
         case 4:
            this.a((zbtz)((ArcShape)var2).ab(), 0);
            break;
         case 5:
            Chart var3 = ((ChartShape)var2).a();
            var3.a(this.i().z());
            break;
         case 6:
            this.a((zbtz)((TextBox)var2).aa(), 0);
            break;
         case 7:
            this.a((zbtz)((Button)var2).aa(), 0);
         case 8:
         case 9:
         case 10:
         case 13:
         case 15:
         case 16:
         case 17:
         case 18:
         case 20:
         case 21:
         case 22:
         case 23:
         case 24:
         case 25:
         case 26:
         case 27:
         case 28:
         case 29:
         default:
            break;
         case 11:
            this.a((zbtz)((CheckBox)var2).ab(), 0);
            break;
         case 12:
            this.a((zbtz)((RadioButton)var2).ab(), 0);
            break;
         case 14:
            this.a((zbtz)((Label)var2).ab(), 0);
            break;
         case 19:
            this.a((zbtz)((GroupBox)var2).ab(), 0);
            break;
         case 30:
            this.a((zbtz)((CellsDrawing)var2).ab(), 0);
         }
      }

   }

   void a(zbtz var1, int var2) {
      if (var1 != null) {
         if (var1.l() != null) {
            this.b.a(var1.k());
         } else {
            var1.h(var2);
         }

         if (var1.p() != null && var1.p().size() != 0) {
            var1.o();
            Iterator var3 = var1.p().iterator();

            while(var3.hasNext()) {
               FontSetting var4 = (FontSetting)var3.next();
               if (var4.c() != null) {
                  this.b.a(var4.c());
               }
            }
         }

      }
   }

   zqy c() {
      return this.f;
   }

   zra d() {
      return this.f.a();
   }

   public Shape get(int index) {
      return (Shape)this.a.get(index);
   }

   public Shape get(String name) {
      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         if (com.aspose.cells.b.a.zv.a(this.get(var2).getName(), name, true) == 0) {
            return this.get(var2);
         }
      }

      return null;
   }

   public Shape addCopy(Shape sourceShape, int upperLeftRow, int top, int upperLeftColumn, int left) throws Exception {
      if (sourceShape.S()) {
         return null;
      } else {
         CopyOptions var6 = new CopyOptions(false, 5);
         Shape var7 = this.a(sourceShape, (GroupShape)null, var6);
         var7.a(upperLeftRow, top, upperLeftColumn, left);
         return var7;
      }
   }

   CheckBox a(int var1, int var2, int var3, int var4, int var5, int var6) {
      if (this.f()) {
         return null;
      } else {
         CheckBox var7 = new CheckBox(this);
         var7.a(var1, var2, var3, var4, var5, var6);
         this.c(var7);
         this.c.getCheckBoxes().a(var7);
         return var7;
      }
   }

   TextBox b(int var1, int var2, int var3, int var4, int var5, int var6) {
      TextBox var7 = new TextBox(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      if (!this.f()) {
         this.c.getTextBoxes().a(var7);
      }

      return var7;
   }

   Spinner c(int var1, int var2, int var3, int var4, int var5, int var6) {
      if (this.f()) {
         return null;
      } else {
         Spinner var7 = new Spinner(this);
         var7.a(var1, var2, var3, var4, var5, var6);
         this.c(var7);
         return var7;
      }
   }

   ScrollBar d(int var1, int var2, int var3, int var4, int var5, int var6) {
      if (this.f()) {
         return null;
      } else {
         ScrollBar var7 = new ScrollBar(this);
         var7.a(var1, var2, var3, var4, var5, var6);
         this.c(var7);
         return var7;
      }
   }

   RadioButton e(int var1, int var2, int var3, int var4, int var5, int var6) {
      RadioButton var7 = new RadioButton(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   ListBox f(int var1, int var2, int var3, int var4, int var5, int var6) {
      ListBox var7 = new ListBox(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   ComboBox g(int var1, int var2, int var3, int var4, int var5, int var6) {
      ComboBox var7 = new ComboBox(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   GroupBox h(int var1, int var2, int var3, int var4, int var5, int var6) {
      GroupBox var7 = new GroupBox(this);
      var7.N().h().a(1);
      var7.a(var1, var2, var3, var4, var5, var6);
      var7.aa().k().setSize(8);
      var7.aa().k().b("Tahoma");
      var7.aa().a(true);
      this.c(var7);
      return var7;
   }

   Button i(int var1, int var2, int var3, int var4, int var5, int var6) {
      Button var7 = new Button(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   Label j(int var1, int var2, int var3, int var4, int var5, int var6) {
      Label var7 = new Label(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   public Label addLabelInChart(int top, int left, int height, int width) {
      if (!this.f()) {
         return null;
      } else {
         Label var5 = new Label(this);
         this.c(var5);
         var5.a(2, left, top, width, height);
         return var5;
      }
   }

   public TextBox addTextBoxInChart(int top, int left, int height, int width) {
      if (!this.f()) {
         return null;
      } else {
         TextBox var5 = new TextBox(this);
         this.c(var5);
         var5.a(2, left, top, width, height);
         return var5;
      }
   }

   public Shape addTextEffectInChart(int effect, String text, String fontName, int size, boolean fontBold, boolean fontItalic, int top, int left, int height, int width) {
      if (!this.f()) {
         return null;
      } else {
         CellsDrawing var11 = new CellsDrawing(this);
         this.c(var11);
         var11.a(2, left, top, width, height);
         TextEffectFormat var12 = new TextEffectFormat(var11);
         var12.setTextEffect(effect);
         var12.setText(text);
         var12.setFontName(fontName);
         var12.setFontSize(size);
         var12.setFontBold(fontBold);
         var12.setFontItalic(fontItalic);
         return var11;
      }
   }

   public Shape addTextEffect(int effect, String text, String fontName, int size, boolean fontBold, boolean fontItalic, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width) {
      CellsDrawing var13 = new CellsDrawing(this);
      var13.f(true);
      var13.a(upperLeftRow, top, upperLeftColumn, left, height, width);
      TextEffectFormat var14 = new TextEffectFormat(var13);
      var14.setTextEffect(effect);
      var14.setText(text);
      var14.setFontName(fontName);
      var14.setFontSize(size);
      var14.setFontBold(fontBold);
      var14.setFontItalic(fontItalic);
      this.c(var13);
      return var13;
   }

   RectangleShape k(int var1, int var2, int var3, int var4, int var5, int var6) {
      RectangleShape var7 = new RectangleShape(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   Oval l(int var1, int var2, int var3, int var4, int var5, int var6) {
      Oval var7 = new Oval(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   LineShape m(int var1, int var2, int var3, int var4, int var5, int var6) {
      LineShape var7 = new LineShape(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   public Shape addFreeFloatingShape(int type, int top, int left, int height, int width, byte[] imageData, boolean isOriginalSize) {
      Object var8 = null;
      switch(type) {
      case 1:
         var8 = new LineShape(this);
         this.c((Shape)var8);
         break;
      case 8:
         Picture var9 = new Picture(this);
         var8 = var9;
         if (imageData != null) {
            var9.a(this.a((Shape)var9, (byte[])imageData));
            zcb var10 = var9.a();
            if (isOriginalSize && var10 != null) {
               width = var10.k();
               height = var10.l();
            }
         } else {
            this.c(var9);
         }

         this.c.getPictures().a(var9);
      }

      if (var8 != null) {
         ((Shape)var8).a(0, false, left, top, width, height);
      }

      return (Shape)var8;
   }

   public Shape addShapeInChart(int type, int placement, int left, int top, int right, int bottom, byte[] imageData) {
      Object var8 = null;
      switch(type) {
      case 0:
         GroupShape var11 = new GroupShape(this);
         var8 = var11;
         this.c(var11);
         break;
      case 1:
         var8 = new LineShape(this);
         this.c((Shape)var8);
         break;
      case 2:
         var8 = new RectangleShape(this);
         this.c((Shape)var8);
         break;
      case 3:
         var8 = new Oval(this);
         this.c((Shape)var8);
         break;
      case 4:
         var8 = new ArcShape(this);
         this.c((Shape)var8);
      case 5:
      case 9:
      case 10:
      case 13:
      case 15:
      case 21:
      case 22:
      case 23:
      case 25:
      case 26:
      case 27:
      case 28:
      default:
         break;
      case 6:
         var8 = new TextBox(this);
         this.c((Shape)var8);
         break;
      case 7:
         var8 = new Button(this);
         this.c((Shape)var8);
         break;
      case 8:
         Picture var10 = new Picture(this);
         var8 = var10;
         if (imageData != null) {
            var10.a(this.a((Shape)var10, (byte[])imageData));
         } else {
            this.c(var10);
         }
         break;
      case 11:
         var8 = new CheckBox(this);
         this.c((Shape)var8);
         break;
      case 12:
         var8 = new RadioButton(this);
         this.c((Shape)var8);
         break;
      case 14:
         var8 = new Label(this);
         this.c((Shape)var8);
         break;
      case 16:
         var8 = new Spinner(this);
         this.c((Shape)var8);
         break;
      case 17:
         var8 = new ScrollBar(this);
         this.c((Shape)var8);
         break;
      case 18:
         var8 = new ListBox(this);
         this.c((Shape)var8);
         break;
      case 19:
         var8 = new GroupBox(this);
         this.c((Shape)var8);
         break;
      case 20:
         var8 = new ComboBox(this);
         this.c((Shape)var8);
         break;
      case 24:
         OleObject var9 = new OleObject(this);
         var8 = var9;
         var9.a(this.a((Shape)var9, (byte[])imageData));
         break;
      case 29:
         var8 = new Shape(this, 29, this);
         this.c((Shape)var8);
      }

      if (var8 != null) {
         ((Shape)var8).a(placement, left, top, right - left, bottom - top);
      }

      return (Shape)var8;
   }

   public Shape addShapeInChart(int type, int placement, int left, int top, int right, int bottom) {
      return this.addShapeInChart(type, placement, left, top, right, bottom, (byte[])null);
   }

   ArcShape n(int var1, int var2, int var3, int var4, int var5, int var6) {
      ArcShape var7 = new ArcShape(this);
      var7.a(var1, var2, var3, var4, var5, var6);
      this.c(var7);
      return var7;
   }

   public Shape addShape(int type, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width) {
      switch(type) {
      case 1:
         return this.m(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 2:
         return this.k(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 3:
         return this.l(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 4:
         return this.n(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 5:
      case 8:
      case 9:
      case 10:
      case 13:
      case 15:
      default:
         CellsDrawing var8 = new CellsDrawing(this);
         var8.a(upperLeftRow, top, upperLeftColumn, left, height, width);
         this.c(var8);
         return var8;
      case 6:
         return this.b(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 7:
         return this.i(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 11:
         return this.a(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 12:
         return this.e(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 14:
         return this.j(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 16:
         return this.c(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 17:
         return this.d(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 18:
         return this.f(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 19:
         return this.h(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 20:
         return this.g(upperLeftRow, top, upperLeftColumn, left, height, width);
      }
   }

   public Shape addAutoShape(int type, int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width) {
      switch(type) {
      case 1:
         return this.k(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 3:
         return this.l(upperLeftRow, top, upperLeftColumn, left, height, width);
      case 19:
         return this.n(upperLeftRow, top, upperLeftColumn, left, height, width);
      default:
         CellsDrawing var8 = new CellsDrawing(this, type);
         var8.a(upperLeftRow, top, upperLeftColumn, left, height, width);
         this.c(var8);
         return var8;
      }
   }

   public Shape addAutoShapeInChart(int type, int top, int left, int height, int width) {
      if (!this.f()) {
         return null;
      } else {
         Object var6 = null;
         switch(type) {
         case 1:
            var6 = new RectangleShape(this);
            break;
         case 3:
            var6 = new Oval(this);
            break;
         case 19:
            var6 = new ArcShape(this);
            break;
         default:
            var6 = new CellsDrawing(this, type);
         }

         ((Shape)var6).a(2, left, top, width, height);
         this.c((Shape)var6);
         return (Shape)var6;
      }
   }

   public Picture addPicture(int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn, InputStream stream) {
      com.aspose.cells.b.a.d.zh var6 = null;
      if (stream != null) {
         var6 = com.aspose.cells.a.c.zw.a(stream);
      }

      return this.a(upperLeftRow, upperLeftColumn, lowerRightRow, lowerRightColumn, var6);
   }

   Picture a(int var1, int var2, int var3, int var4, com.aspose.cells.b.a.d.zm var5) {
      if (this.f()) {
         return null;
      } else {
         zakq.a(var1, var2, var3, var4);
         Picture var6 = new Picture(this);
         var6.a(this.a((Shape)var6, (byte[])com.aspose.cells.a.c.zw.a(var5, false)));
         var6.moveToRange(var1, var2, var3, var4);
         this.c.getPictures().a(var6);
         return var6;
      }
   }

   public Picture addPicture(int upperLeftRow, int upperLeftColumn, InputStream stream, int widthScale, int heightScale) {
      com.aspose.cells.b.a.d.zh var6 = null;
      if (stream != null) {
         var6 = com.aspose.cells.a.c.zw.a(stream);
      }

      return this.a(upperLeftRow, upperLeftColumn, var6, widthScale, heightScale);
   }

   Picture a(int var1, int var2, com.aspose.cells.b.a.d.zm var3, int var4, int var5) {
      if (var4 > 0 && var5 > 0) {
         zakq.a(var1, var2);
         Picture var6 = new Picture(this);
         var6.a(this.a((Shape)var6, (byte[])com.aspose.cells.a.c.zw.a(var3, false)));
         zcb var7 = var6.a();
         int var8 = 0;
         int var9 = 0;
         if (var7 != null) {
            var8 = (int)((double)((float)(var7.k() * var4) / 100.0F) + 0.5D);
            var9 = (int)((double)((float)(var7.l() * var5) / 100.0F) + 0.5D);
         }

         var6.a(var1, 0, var2, 0, var9, var8);
         this.c.getPictures().a(var6);
         return var6;
      } else {
         throw new CellsException(6, "Scale of image should be larger than 0.");
      }
   }

   public Picture addLinkedPicture(int upperLeftRow, int upperLeftColumn, int height, int width, String sourceFullName) {
      Picture var6 = new Picture(this);
      this.c(var6);
      var6.setSourceFullName(sourceFullName);
      var6.a(upperLeftRow, 0, upperLeftColumn, 0, height, width);
      this.c.getPictures().a(var6);
      return var6;
   }

   public OleObject addOleObjectWithLinkedImage(int upperLeftRow, int upperLeftColumn, int height, int width, String sourceFullName) {
      OleObject var6 = new OleObject(this);
      this.c(var6);
      var6.setImageSourceFullName(sourceFullName);
      ++this.i().c;
      var6.e(this.i().c);
      var6.a(upperLeftRow, 0, upperLeftColumn, 0, height, width);
      this.c.getOleObjects().a(var6);
      return var6;
   }

   public Picture addPictureInChart(int top, int left, InputStream stream, int widthScale, int heightScale) {
      com.aspose.cells.b.a.d.zh var6 = null;
      if (stream != null) {
         var6 = com.aspose.cells.a.c.zw.a(stream);
      }

      return this.b(top, left, var6, widthScale, heightScale);
   }

   Picture b(int var1, int var2, com.aspose.cells.b.a.d.zm var3, int var4, int var5) {
      if (!this.f()) {
         return null;
      } else if (var4 > 0 && var5 > 0) {
         Picture var6 = new Picture(this);
         var6.a(this.a((Shape)var6, (byte[])com.aspose.cells.a.c.zw.a(var3, false)));
         zcb var7 = var6.a();
         int var8 = 0;
         int var9 = 0;
         if (var7 != null) {
            var8 = (int)((double)((float)(var7.k() * var4) / 100.0F) + 0.5D);
            var9 = (int)((double)((float)(var7.l() * var5) / 100.0F) + 0.5D);
         }

         Chart var10 = (Chart)this.d;
         var8 = (int)((double)((float)var8 * 4000.0F / (float)var10.getChartObject().getWidth()) + 0.5D);
         var9 = (int)((double)((float)var9 * 4000.0F / (float)var10.getChartObject().getHeight()) + 0.5D);
         if (var8 + var2 > 4000) {
            var8 = 4000 - var2;
         }

         if (var9 + var1 > 4000) {
            var9 = 4000 - var1;
         }

         var6.a(2, var2, var1, var8, var9);
         return var6;
      } else {
         throw new CellsException(6, "Scale of image should be larger than 0.");
      }
   }

   public OleObject addOleObject(int upperLeftRow, int top, int upperLeftColumn, int left, int height, int width, byte[] imageData) {
      if (this.f()) {
         return null;
      } else {
         zakq.a(upperLeftRow, upperLeftColumn);
         OleObject var8 = new OleObject(this);
         if (imageData != null) {
            var8.a(this.a((Shape)var8, (byte[])imageData));
            var8.N().h().a(1);
            var8.a(upperLeftRow, top, upperLeftColumn, left, height, width);
         } else {
            this.a((Shape)var8, (byte[])null);
         }

         ++this.i().c;
         var8.e(this.i().c);
         this.c.getOleObjects().a(var8);
         return var8;
      }
   }

   int e() {
      return this.e;
   }

   void b(int var1) {
      this.e = var1 & '\uffff';
   }

   public void copyCommentsInRange(ShapeCollection shapes, CellArea ca, int destRow, int destColumn) {
      int var5 = shapes.getCount();
      CommentShape var6 = null;
      CopyOptions var7 = new CopyOptions(false);

      for(int var8 = 0; var8 < var5; ++var8) {
         Shape var9 = shapes.get(var8);
         if (!var9.S() && var9.getMsoDrawingType() == 25) {
            Comment var10 = ((CommentShape)var9).a();
            if (var10.getRow() >= ca.StartRow && var10.getRow() <= ca.EndRow && var10.getColumn() >= ca.StartColumn && var10.getColumn() <= ca.EndColumn) {
               Comment var11 = new Comment(this.j().getComments(), destRow & '\uffff', (byte)var10.getColumn() & 255);
               var11.getCommentShape().a((CommentShape)var9, var7);
               var6 = var11.getCommentShape();
               this.c(var11.getCommentShape());
               this.j().getComments().a(var11);
               int var12 = 1;
               if (destRow != 0) {
                  var12 = var6.c(0, 0, destRow - 1, 105);
               }

               var6.setTopToCorner(var12);
            }
         }
      }

   }

   public void copyInRange(ShapeCollection sourceShapes, CellArea ca, int destRow, int destColumn, boolean isContained) throws Exception {
      int var6 = sourceShapes.getCount();
      boolean var7 = false;
      boolean var8 = false;
      CopyOptions var9 = new CopyOptions(false, 4);

      for(int var10 = 0; var10 < var6; ++var10) {
         var8 = false;
         Shape var11 = sourceShapes.get(var10);
         if (!var11.S() && var11.getMsoDrawingType() != 25) {
            int var12 = var11.getUpperLeftRow();
            int var13 = var11.getUpperLeftColumn();
            int var14 = var11.getLowerDeltaY() == 0 ? var11.getLowerRightRow() - 1 : var11.getLowerRightRow();
            int var15 = var11.getLowerDeltaX() == 0 ? var11.getLowerRightColumn() - 1 : var11.getLowerRightColumn();
            if (isContained) {
               if (var12 >= ca.StartRow && var13 >= ca.StartColumn && var14 <= ca.EndRow && var15 <= ca.EndColumn) {
                  var8 = true;
               }
            } else if (var12 >= ca.StartRow - 1 && var13 >= ca.StartColumn - 1 && var12 <= ca.EndRow && var13 <= ca.EndColumn && var14 >= ca.StartRow && var15 >= ca.StartColumn && var14 <= ca.EndRow + 1 && var15 <= ca.EndColumn + 1) {
               var8 = true;
            }

            if (var8) {
               int var18 = this.getCount();
               this.a(var11, (GroupShape)null, var9);
               Shape var16 = this.get(var18);
               int var17 = var16.getPlacement();
               var16.setPlacement(1);
               var16.setUpperLeftRow(var16.getUpperLeftRow() - ca.StartRow + destRow);
               var16.setUpperLeftColumn(var16.getUpperLeftColumn() - ca.StartColumn + destColumn);
               var16.setPlacement(var17);
            }
         }
      }

   }

   public void deleteInRange(CellArea ca) {
      int var2 = this.getCount();
      boolean var3 = true;

      for(int var4 = 0; var4 < var2; ++var4) {
         Shape var5 = this.get(var4);
         if (!var5.S() && var5.getMsoDrawingType() != 25 && var5.getUpperLeftRow() >= ca.StartRow && var5.getUpperLeftColumn() >= ca.StartColumn) {
            int var6 = var5.getLowerDeltaY() == 0 ? var5.getLowerRightRow() - 1 : var5.getLowerRightRow();
            int var7 = var5.getLowerDeltaX() == 0 ? var5.getLowerRightColumn() - 1 : var5.getLowerRightColumn();
            if (var6 <= ca.EndRow && var7 <= ca.EndColumn) {
               int var8 = var5.z();
               this.b(var5);
               var4 -= var8;
               var2 -= var8;
               if (var4 < -1) {
                  var4 = -1;
               }
            }
         }
      }

   }

   public void deleteShape(Shape shape) {
      if (!shape.S() && shape.getMsoDrawingType() != 25) {
         this.b(shape);
      }
   }

   void a(ShapeCollection var1, int var2, int var3, int var4) {
      new CopyOptions(false);
      if (var2 != var3 || var1 != this) {
         this.j().getComments().a(var1.j().getComments(), var2, var3, var4);
         this.j().getCharts().a(var1.j().getCharts(), var2, var3, var4);
      }
   }

   void b(ShapeCollection var1, int var2, int var3, int var4) throws Exception {
      CopyOptions var5 = new CopyOptions(false);
      if (var2 != var3 || var1 != this) {
         int var6 = var2;
         int var7 = var2 + var4 - 1;
         int var8 = var3 - var2;
         boolean var9 = false;
         boolean var10 = false;
         boolean var11 = false;
         boolean var12 = false;
         Shape var13 = null;
         int var14 = var1.getCount();

         for(int var15 = 0; var15 < var14; ++var15) {
            Shape var16 = var1.get(var15);
            if ((double)var16.getWidth() >= Double.MIN_VALUE && (double)var16.getHeight() >= Double.MIN_VALUE && !var16.S()) {
               if (var16.getMsoDrawingType() == 25) {
                  CommentShape var17 = (CommentShape)var16;
                  Comment var18 = var17.a();
                  if (var18.getRow() >= var2 && var18.getRow() < var2 + var4) {
                     int var19 = this.j().getComments().add(var3 + var18.getRow() - var2, var18.getColumn());
                     Comment var20 = this.j().getComments().get(var19);
                     var20.a(var18);
                     var20.getCommentShape().setWidth(var17.getWidth());
                     var20.getCommentShape().setHeight(var17.getHeight());
                  }
               } else if (var16.getPlacement() != 0) {
                  int var21 = var16.getUpperLeftRow();
                  int var22 = var16.getLowerRightRow();
                  int var23 = (double)var16.getUpperDeltaY() == zjx.b ? var21 + 1 : var21;
                  int var24 = var16.getLowerDeltaY() == 0 ? var22 - 1 : var22;
                  if (var23 >= var6 && var24 <= var7) {
                     var13 = this.a(var16, (GroupShape)null, var5);
                     switch(var13.getPlacement()) {
                     case 1:
                        var13.N().h().b(var21 + var8);
                        break;
                     case 2:
                        var13.N().h().b(var21 + var8);
                        var13.N().h().f(var22 + var8);
                     }
                  }
               }
            }
         }

      }
   }

   void a(ShapeCollection var1, CellArea var2, CellArea var3, CopyOptions var4) throws Exception {
      int var5 = var1.getCount();

      for(int var6 = 0; var6 < var5; ++var6) {
         Shape var7 = var1.get(var6);
         if (!var7.S() && var7.getMsoDrawingType() != 25) {
            int var8 = var7.getPlacement();
            var7.setPlacement(2);
            int var9 = (double)var7.getUpperDeltaX() == zjx.a ? var7.getUpperLeftColumn() + 1 : var7.getUpperLeftColumn();
            int var10 = var7.getLowerDeltaX() == 0 ? var7.getLowerRightColumn() - 1 : var7.getLowerRightColumn();
            int var11 = (double)var7.getUpperDeltaY() == zjx.b ? var7.getUpperLeftRow() + 1 : var7.getUpperLeftRow();
            int var12 = var7.getLowerDeltaY() == 0 ? var7.getLowerRightRow() - 1 : var7.getLowerRightRow();
            int var13 = var3.StartRow - var2.StartRow;
            int var14 = var3.StartColumn - var2.StartColumn;
            if (var9 >= var2.StartColumn && var10 <= var2.EndColumn && var11 >= var2.StartRow && var12 <= var2.EndRow) {
               var7.setPlacement(1);
               Shape var15 = this.a(var7, (GroupShape)null, var4);
               var15.N().h().b(var15.N().h().f() + var13);
               var15.N().h().d(var15.N().h().i() + var14);
               var15.setPlacement(var8);
            }

            var7.setPlacement(var8);
         }
      }

   }

   void a(ShapeCollection var1, CopyOptions var2) throws Exception {
      int var3 = this.getCount();
      Iterator var4 = var1.iterator();

      Shape var5;
      while(var4.hasNext()) {
         var5 = (Shape)var4.next();
         if (!var5.S() && var5.getMsoDrawingType() != 29) {
            this.a(var5, (GroupShape)null, var2);
         }
      }

      if (this.b == var1.b && this.f() == var1.f() && var3 == 0) {
         this.g = var1.g;
         var4 = var1.iterator();

         while(var4.hasNext()) {
            var5 = (Shape)var4.next();
            if (var5.getMsoDrawingType() == 29 && var5.g != null && !var5.g.i) {
               Shape var6;
               if (var5.P()) {
                  var6 = this.addShapeInChart(29, 1, 0, 0, 0, 0);
               } else {
                  var6 = this.addShape(29, 0, 0, 0, 0, 0, 0);
               }

               var6.g = new zpq();
               var6.g.e = var5.g.e;
               var6.g.g = var5.g.g;
            }
         }
      }

   }

   Shape a(Shape var1, GroupShape var2, CopyOptions var3) throws Exception {
      Object var4;
      var4 = null;
      label75:
      switch(var1.getMsoDrawingType()) {
      case 0:
         GroupShape var28 = (GroupShape)var1;
         GroupShape var29 = new GroupShape(this);
         var4 = var29;
         this.c(var29);
         var29.a(var28, var3);
         Shape[] var30 = var28.getGroupedShapes();
         if (var30 != null && var30.length != 0) {
            Shape[] var47 = var30;
            int var48 = var30.length;
            int var49 = 0;

            while(true) {
               if (var49 >= var48) {
                  break label75;
               }

               Shape var50 = var47[var49];
               this.a(var50, var29, var3);
               ++var49;
            }
         } else {
            var29.e();
            break;
         }
      case 1:
         LineShape var37 = (LineShape)var1;
         LineShape var38 = new LineShape(this);
         var4 = var38;
         var38.a(var37, var3);
         this.c(var38);
         break;
      case 2:
         RectangleShape var43 = (RectangleShape)var1;
         RectangleShape var44 = new RectangleShape(this);
         var4 = var44;
         var44.a(var43, var3);
         this.c(var44);
         break;
      case 3:
         Oval var39 = (Oval)var1;
         Oval var40 = new Oval(this);
         var4 = var40;
         var40.a(var39, var3);
         this.c(var40);
         break;
      case 4:
         ArcShape var35 = (ArcShape)var1;
         ArcShape var36 = new ArcShape(this);
         var4 = var36;
         var36.a(var35, var3);
         this.c(var36);
         break;
      case 5:
         Chart var5 = new Chart(this.c);
         var5.getChartObject().a((ChartShape)var1, var3);
         var4 = var5.getChartObject();
         this.c(var5.getChartObject());
         if (!this.f()) {
            this.b.get(this.c.m()).getCharts().a(var5);
         }
         break;
      case 6:
         TextBox var8 = (TextBox)var1;
         TextBox var9 = new TextBox(this);
         var4 = var9;
         this.c(var9);
         var9.a(var8, var3);
         if (!this.f()) {
            this.b.get(this.c.m()).getTextBoxes().a(var9);
         }
         break;
      case 7:
         Button var14 = (Button)var1;
         Button var15 = new Button(this);
         var4 = var15;
         this.c(var15);
         var15.a(var14, var3);
         break;
      case 8:
         Picture var31 = (Picture)var1;
         Picture var32 = new Picture(this);
         this.c(var32);
         var4 = var32;
         var32.a(var31, var3);
         if (!this.f()) {
            this.b.get(this.c.m()).getPictures().a(var32);
         }
         break;
      case 9:
         zavf var41 = (zavf)var1;
         zavf var42 = new zavf(this);
         var4 = var42;
         var42.a(var41, var3);
         this.c(var42);
         break;
      case 10:
      case 13:
      case 15:
      case 21:
      case 22:
      case 23:
      case 26:
      case 27:
      case 28:
      case 29:
      default:
         var4 = new Shape(this, var1.getMsoDrawingType(), this);
         ((Shape)var4).a(var1, var3);
         this.c((Shape)var4);
         break;
      case 11:
         CheckBox var10 = (CheckBox)var1;
         CheckBox var11 = new CheckBox(this);
         var4 = var11;
         this.c(var11);
         var11.a(var10, var3);
         this.b.get(this.c.m()).getCheckBoxes().a(var11);
         break;
      case 12:
         RadioButton var12 = (RadioButton)var1;
         RadioButton var13 = new RadioButton(this);
         var4 = var13;
         this.c(var13);
         var13.a(var12, var3);
         break;
      case 14:
         Label var18 = (Label)var1;
         Label var19 = new Label(this);
         var4 = var19;
         this.c(var19);
         var19.a(var18, var3);
         break;
      case 16:
         Spinner var26 = (Spinner)var1;
         Spinner var27 = new Spinner(this);
         var4 = var27;
         this.c(var27);
         var27.a(var26, var3);
         break;
      case 17:
         ScrollBar var24 = (ScrollBar)var1;
         ScrollBar var25 = new ScrollBar(this);
         var4 = var25;
         this.c(var25);
         var25.a(var24, var3);
         break;
      case 18:
         ListBox var22 = (ListBox)var1;
         ListBox var23 = new ListBox(this);
         var4 = var23;
         this.c(var23);
         var23.a(var22, var3);
         break;
      case 19:
         GroupBox var16 = (GroupBox)var1;
         GroupBox var17 = new GroupBox(this);
         var4 = var17;
         this.c(var17);
         var17.a(var16, var3);
         break;
      case 20:
         ComboBox var20 = (ComboBox)var1;
         ComboBox var21 = new ComboBox(this);
         var4 = var21;
         this.c(var21);
         var21.a(var20, var3);
         break;
      case 24:
         OleObject var33 = (OleObject)var1;
         OleObject var34 = new OleObject(this);
         var4 = var34;
         var34.a(var33, var3);
         this.c(var34);
         if (!this.f()) {
            this.b.get(this.c.m()).getOleObjects().a(var34);
         }
         break;
      case 25:
         Comment var6 = ((CommentShape)var1).a();
         Comment var7 = new Comment(this.j().getComments(), var6.getRow() & '\uffff', (byte)var6.getColumn() & 255);
         var7.getCommentShape().a((CommentShape)var1, var3);
         var4 = var7.getCommentShape();
         this.c(var7.getCommentShape());
         if (!this.f()) {
            this.b.get(this.c.m()).getComments().a(var7);
         }
         break;
      case 30:
         CellsDrawing var45 = (CellsDrawing)var1;
         CellsDrawing var46 = new CellsDrawing(this);
         var4 = var46;
         var46.a(var45, var3);
         this.c(var46);
      }

      if (this.i() != var1.L() && ((Shape)var4).O() != null && !var3.a) {
         ((Shape)var4).O().a = null;
      }

      if (this.i() != var1.L() && var3.a && var1.K() != ((Shape)var4).K()) {
         ((Shape)var4).f(var1.K());
         if (this.e < ((Shape)var4).K()) {
            this.e = ((Shape)var4).K();
         }
      }

      if (var2 != null) {
         var2.a((Shape)var4);
      }

      return (Shape)var4;
   }

   public GroupShape group(Shape[] groupItems) {
      if (this.g()) {
         return null;
      } else {
         GroupShape var2 = new GroupShape(this);
         this.c(var2);
         int[][] var3 = new int[groupItems.length][];
         int var4 = 0;
         int var5 = 0;
         int var6 = 0;
         int var7 = 0;

         int var8;
         for(var8 = 0; var8 < groupItems.length; ++var8) {
            if (groupItems[var8].J() != this) {
               throw new CellsException(10, "Please add the shape to here.");
            }

            if (groupItems[var8].isGroup()) {
               throw new CellsException(10, "Please ungroup the shape before grouping shapes");
            }

            if (groupItems[var8].O().e()) {
               throw new CellsException(10, "Could not be grouped.");
            }

            groupItems[var8].N().i().b(true);
            int[] var9 = new int[4];
            if (this.f()) {
               var9 = groupItems[var8].d(false);
               switch(groupItems[0].getPlacement()) {
               case 1:
                  Chart var10 = (Chart)groupItems[var8].J().h();
                  var9[2] = (int)((double)((float)var9[2] * 4000.0F / (float)var10.getChartObject().getWidth()) + 0.5D);
                  var9[3] = (int)((double)((float)var9[3] * 4000.0F / (float)var10.getChartObject().getHeight()) + 0.5D);
               }
            } else {
               var9 = groupItems[var8].d(true);
            }

            var3[var8] = var9;
            if (var8 == 0) {
               var4 = var9[0];
               var5 = var9[1];
               var6 = var9[2] + var9[0];
               var7 = var9[3] + var9[1];
            } else {
               if (var4 > var9[0]) {
                  var4 = var9[0];
               }

               if (var5 > var9[1]) {
                  var5 = var9[1];
               }

               if (var6 < var9[0] + var9[2]) {
                  var6 = var9[0] + var9[2];
               }

               if (var7 < var9[1] + var9[3]) {
                  var7 = var9[1] + var9[3];
               }
            }
         }

         var8 = var6 - var4;
         int var12 = var7 - var5;
         var2.a(0, false, var4, var5, var8, var12);
         var2.a().a = var4;
         var2.a().c = var5;
         var2.a().b = var8;
         var2.a().d = var12;
         if (!this.f()) {
            var2.setPlacement(2);
         }

         for(int var13 = 0; var13 < groupItems.length; ++var13) {
            int[] var11 = var3[var13];
            groupItems[var13].a(0, false, (int)((double)((float)(var11[0] - var4) * 4000.0F / (float)var8) + 0.5D), (int)((double)((float)(var11[1] - var5) * 4000.0F / (float)var12) + 0.5D), (int)((double)((float)var11[2] * 4000.0F / (float)var8) + 0.5D), (int)((double)((float)var11[3] * 4000.0F / (float)var12) + 0.5D));
            var2.a(groupItems[var13]);
         }

         return var2;
      }
   }

   void a(GroupShape var1, Shape[] var2) {
      int var3;
      for(var3 = 0; var3 < var2.length; ++var3) {
         var2[var3].N().i().b(true);
      }

      var3 = var1.a().a;
      int var4 = var1.a().c;
      int var5 = var1.a().b;
      int var6 = var1.a().d;

      for(int var7 = 0; var7 < var2.length; ++var7) {
         int[] var8 = var2[var7].G();
         var2[var7].a(0, false, (int)((double)var8[0] / (double)var5 * 4000.0D + 0.5D), (int)((double)var8[1] / (double)var6 * 4000.0D + 0.5D), (int)((double)var8[2] / (double)var5 * 4000.0D + 0.5D), (int)((double)var8[3] / (double)var6 * 4000.0D + 0.5D));
         var1.a(var2[var7]);
      }

   }

   public void ungroup(GroupShape group) {
      if (group.isGroup()) {
         if (!group.S()) {
            Shape[] var2 = group.getGroupedShapes();
            int[] var10;
            int var16;
            int var17;
            int var18;
            if (this.f()) {
               byte var3 = 0;
               byte var4 = 0;
               byte var5 = 0;
               byte var6 = 0;
               int[] var7 = new int[]{var3};
               int[] var8 = new int[]{var4};
               int[] var9 = new int[]{var5};
               var10 = new int[]{var6};
               group.a(var7, var8, var9, var10);
               int var14 = var7[0];
               var16 = var8[0];
               var17 = var9[0];
               var18 = var10[0];

               for(int var11 = 0; var11 < var2.length; ++var11) {
                  Shape var12 = var2[var11];
                  var12.n = group.n;
                  var12.N().i().b(false);
                  int[] var13 = var12.d(false);
                  var13[0] = (int)((double)((float)(var17 * var13[0]) / 4000.0F) + 0.5D + (double)var14);
                  var13[1] = (int)((double)((float)(var18 * var13[1]) / 4000.0F) + 0.5D + (double)var16);
                  var13[2] = (int)((double)((float)(var17 * var13[2]) / 4000.0F) + 0.5D + (double)var13[0]);
                  var13[3] = (int)((double)((float)(var18 * var13[3]) / 4000.0F) + 0.5D + (double)var13[1]);
                  var12.a(0, true, var13[0], var13[1], var13[2], var13[3]);
               }
            } else {
               int[] var15 = group.d(true);
               var16 = var15[0];
               var17 = var15[1];
               var18 = var15[2];
               int var19 = var15[3];

               for(int var20 = 0; var20 < var2.length; ++var20) {
                  Shape var21 = var2[var20];
                  var21.N().i().b(false);
                  var21.n = group.n;
                  var10 = var2[var20].d(false);
                  var10[0] = (int)((double)((float)(var18 * var10[0]) / 4000.0F + (float)var16) + 0.5D);
                  var10[1] = (int)((double)((float)(var19 * var10[1]) / 4000.0F + (float)var17) + 0.5D);
                  var10[2] = (int)((double)((float)(var18 * var10[2]) / 4000.0F) + 0.5D);
                  var10[3] = (int)((double)((float)(var19 * var10[3]) / 4000.0F) + 0.5D);
                  var2[var20].a(0, false, var10[0], var10[1], var10[2], var10[3]);
               }
            }

            group.f();
            this.b(group);
         }
      }
   }

   public void removeAt(int index) {
      this.b(this.get(index));
   }

   public void remove(Shape shape) {
      this.deleteShape(shape);
   }

   public void clear() {
      this.j().getCharts().clear();
      this.j().getPictures().clear();
      this.j().getTextBoxes().clear();
      this.j().getCheckBoxes().clear();
      this.a.clear();
   }

   public void updateSelectedValue() throws Exception {
      for(int var1 = 0; var1 < this.getCount(); ++var1) {
         this.get(var1).updateSelectedValue();
      }

   }

   void c(int var1) {
      this.b(this.get(var1));
   }

   void d(int var1) {
      this.a.remove(var1);
   }

   void a(int var1, Shape var2) {
      if (var1 >= this.getCount()) {
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var2);
      } else {
         this.a.add(var1, var2);
      }

   }

   void a(Shape var1) {
      this.a.remove(var1);
   }

   void e(int var1) {
      Iterator var2 = this.iterator();

      while(var2.hasNext()) {
         Shape var3 = (Shape)var2.next();
         if (var3.K() == var1) {
            this.b(var3);
            break;
         }
      }

   }

   void a(int var1, int var2, Worksheet var3, boolean var4) {
      if (var2 != 0) {
         if (this.j().getComments().getCount() != 0) {
            this.j().getComments().b(var1, var2);
         }

         if (this.j().getCharts().getCount() != 0) {
            this.j().getCharts().a(var1, var2, var3, var4);
         }

         Iterator var5 = this.iterator();

         while(var5.hasNext()) {
            Shape var6 = (Shape)var5.next();
            if (var6.X() != null) {
               byte[] var7 = var6.X();
               zyo.a(var3, var4, var1, var2, 0, 0, 0, var7.length - 1, var7);
            }

            switch(var6.getMsoDrawingType()) {
            case 18:
               ListBox var10 = (ListBox)var6;
               if (var10.Z() != null) {
                  byte[] var11 = var10.Z();
                  zyo.a(var3, var4, var1, var2, 0, 0, 0, var11.length - 1, var11);
               }
               break;
            case 20:
               ComboBox var8 = (ComboBox)var6;
               if (var8.Z() != null) {
                  byte[] var9 = var8.Z();
                  zyo.a(var3, var4, var1, var2, 0, 0, 0, var9.length - 1, var9);
               }
            }

            if (!var6.S()) {
               var6.a(var1, var2, var3, var4);
            }
         }

      }
   }

   void b(int var1, int var2, Worksheet var3, boolean var4) {
      if (var2 != 0) {
         if (this.j().getComments().getCount() != 0) {
            this.j().getComments().c(var1, var2);
         }

         if (this.j().getCharts().getCount() != 0) {
            this.j().getCharts().b(var1, var2, var3, var4);
         }

         Iterator var5 = this.iterator();

         while(var5.hasNext()) {
            Shape var6 = (Shape)var5.next();
            if (var6.X() != null) {
               byte[] var7 = var6.X();
               zyo.c(var3, var4, var1, var2, 0, 0, 0, var7.length - 1, var7);
            }

            switch(var6.getMsoDrawingType()) {
            case 18:
               ListBox var10 = (ListBox)var6;
               if (var10.Z() != null) {
                  byte[] var11 = var10.Z();
                  zyo.c(var3, var4, var1, var2, 0, 0, 0, var11.length - 1, var11);
               }
               break;
            case 20:
               ComboBox var8 = (ComboBox)var6;
               if (var8.Z() != null) {
                  byte[] var9 = var8.Z();
                  zyo.c(var3, var4, var1, var2, 0, 0, 0, var9.length - 1, var9);
               }
            }

            if (!var6.S()) {
               var6.b(var1, var2, var3, var4);
            }
         }

      }
   }

   void a(CellArea var1, int var2, int var3, Worksheet var4, boolean var5) {
      if (var2 != 0) {
         if (var5 && this.j().getComments().getCount() != 0) {
            this.j().getComments().b(var1, var2, var3);
         }

         if (this.j().getCharts().getCount() != 0) {
            this.j().getCharts().a(var1, var2, var3, var4, var5);
         }

         if (var3 != 1 && var3 != 4) {
            Iterator var6 = this.iterator();

            while(var6.hasNext()) {
               Shape var7 = (Shape)var6.next();
               if (var7.X() != null) {
                  byte[] var8 = var7.X();
                  zyo.a(var1, var2, var3, var4, var5, var8, 0, var8.length - 1, 0, 0, 0, 0);
               }

               switch(var7.getMsoDrawingType()) {
               case 18:
                  ListBox var11 = (ListBox)var7;
                  if (var11.Z() != null) {
                     byte[] var12 = var11.Z();
                     zyo.a(var1, var2, var3, var4, var5, var12, 0, var12.length - 1, 0, 0, 0, 0);
                  }
                  break;
               case 20:
                  ComboBox var9 = (ComboBox)var7;
                  if (var9.Z() != null) {
                     byte[] var10 = var9.Z();
                     zyo.a(var1, var2, var3, var4, var5, var10, 0, var10.length - 1, 0, 0, 0, 0);
                  }
               }
            }

            if (var5) {
               switch(var3) {
               case 0:
                  this.b(var1, var2);
                  break;
               case 1:
                  this.c(var1, var2);
               case 2:
               default:
                  break;
               case 3:
                  this.a(var1, var2);
                  break;
               case 4:
                  this.d(var1, var2);
               }
            }

         }
      }
   }

   private void a(CellArea var1, int var2) {
      Iterator var3 = this.iterator();

      while(var3.hasNext()) {
         Shape var4 = (Shape)var3.next();
         if (!var4.S()) {
            var4.a(var1, var2);
         }
      }

   }

   private void b(CellArea var1, int var2) {
      Iterator var3 = this.iterator();

      while(var3.hasNext()) {
         Shape var4 = (Shape)var3.next();
         if (!var4.S()) {
            var4.b(var1, var2);
         }
      }

   }

   private void c(CellArea var1, int var2) {
   }

   private void d(CellArea var1, int var2) {
   }

   void b(Shape var1) {
      GroupShape var2;
      if (var1.isGroup()) {
         var2 = (GroupShape)var1;
         Shape[] var3 = var2.getGroupedShapes();
         if (var3 != null && var3.length != 0) {
            Shape[] var4 = var3;
            int var5 = var3.length;

            for(int var6 = 0; var6 < var5; ++var6) {
               Shape var7 = var4[var6];
               this.b(var7);
            }
         }
      }

      if (var1.S()) {
         var2 = var1.getGroup();
         if (var2.d() != null) {
            for(int var8 = 0; var8 < var2.d().size(); ++var8) {
               if (var2.d().get(var8) == var1) {
                  var2.d().remove(var8);
                  break;
               }
            }
         }
      }

      this.a.remove(var1);
      if (this.d instanceof Worksheet) {
         switch(var1.getMsoDrawingType()) {
         case 5:
            this.c.getCharts().remove(((ChartShape)var1).a());
            break;
         case 6:
            this.c.getTextBoxes().b((TextBox)var1);
         case 7:
         case 9:
         case 10:
         case 12:
         case 13:
         case 14:
         case 15:
         case 16:
         case 17:
         case 18:
         case 19:
         case 21:
         case 22:
         case 23:
         default:
            break;
         case 8:
            this.c.getPictures().b((Picture)var1);
            this.f(((Picture)var1).b());
            break;
         case 11:
            this.c.getCheckBoxes().b((CheckBox)var1);
            break;
         case 20:
            this.c().c().a(this.c().c().b() - 1);
            break;
         case 24:
            this.c.getOleObjects().b((OleObject)var1);
            break;
         case 25:
            this.c.getComments().b(((CommentShape)var1).a());
         }
      }

   }

   void f(int var1) {
      if (var1 != 0) {
         if (this.g(var1)) {
            this.f.a().b().a(var1 - 1).j();
         } else {
            this.f.a().b().removeAt(var1 - 1);
            this.i(var1);
         }
      }
   }

   boolean g(int var1) {
      for(int var2 = 0; var2 < this.i().getCount(); ++var2) {
         Worksheet var3 = this.i().get(var2);
         if (var3.t() != null && var3.getShapes().getCount() > 0 && var3.getShapes().h(var1)) {
            return true;
         }
      }

      return false;
   }

   boolean h(int var1) {
      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         switch(this.get(var2).getMsoDrawingType()) {
         case 5:
            ShapeCollection var4 = ((ChartShape)this.get(var2)).a().l();
            if (var4 != null && var4.h(var1)) {
               return true;
            }
            break;
         case 8:
         case 24:
            int var3 = this.get(var2).N().c().c(16644, 0);
            if (var3 != 0 && var3 == var1) {
               return true;
            }
         }
      }

      return false;
   }

   void i(int var1) {
      for(int var2 = 0; var2 < this.i().getCount(); ++var2) {
         Worksheet var3 = this.i().get(var2);
         if (var3.t() != null && var3.getShapes().getCount() > 0) {
            var3.getShapes().j(var1);
         }
      }

   }

   void j(int var1) {
      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         switch(this.get(var2).getMsoDrawingType()) {
         case 5:
            ShapeCollection var4 = ((ChartShape)this.get(var2)).a().l();
            if (var4 != null) {
               var4.j(var1);
            }
            break;
         case 8:
         case 24:
            int var3 = this.get(var2).N().c().c(16644, 0);
            if (var3 != 0 && var3 > var1) {
               this.get(var2).N().c().a(16644, 0, var3 - 1);
            }
         }
      }

   }

   int a(Shape var1, byte[] var2) {
      int var3 = 0;
      if (var1.K() == 0) {
         ++this.e;
         var1.f(this.e);
         var3 = this.f.a(var1, var2);
      }

      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
      return var3;
   }

   void c(Shape var1) {
      if (var1.K() == 0) {
         ++this.e;
         var1.f(this.e);
         this.f.a(var1);
      }

      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   void a(Shape var1, com.aspose.cells.b.a.d.zm var2) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   boolean f() {
      return this.d instanceof Chart;
   }

   boolean g() {
      return this.d instanceof PageSetup;
   }

   Object h() {
      return this.d;
   }

   WorksheetCollection i() {
      return this.b;
   }

   void a(HashMap var1) {
      if (this.c.getCharts().getCount() > 0) {
         this.c.getCharts().a(var1);
      }

      boolean var2 = false;
      boolean var3 = false;
      boolean var4 = false;
      Iterator var5 = this.iterator();

      while(true) {
         Shape var6;
         do {
            do {
               if (!var5.hasNext()) {
                  return;
               }

               var6 = (Shape)var5.next();
               if (var6.X() != null) {
                  zyo.b(var6.X(), 0, var6.X().length - 1, var1, this.b);
               }
            } while(var6.O().a == null);
         } while(var6.O().a.size() == 0);

         Iterator var7 = var6.O().a.iterator();

         while(var7.hasNext()) {
            byte[] var8 = (byte[])var7.next();
            int var11;
            switch(var8[0]) {
            case 4:
               var11 = com.aspose.cells.b.a.zc.e(var8, 4) & '\uffff';
               int var10 = (com.aspose.cells.b.a.zc.e(var8, 6 + var11) & '\uffff') - 1;
               if (var1.get(var10) != null) {
                  int var9 = (Integer)var1.get(var10) + 1;
                  System.arraycopy(com.aspose.cells.b.a.zc.a(var9), 0, var8, 6 + var11, 2);
               }
               break;
            case 9:
               var11 = com.aspose.cells.b.a.zc.e(var8, 4) & '\uffff';
               if (var11 != 0) {
                  var11 = com.aspose.cells.b.a.zc.e(var8, 6) & '\uffff';
                  zyo.b(var8, 12, 12 + var11, var1, this.b);
               }
            }
         }
      }
   }

   Worksheet j() {
      return this.c;
   }

   boolean k() {
      Iterator var1 = this.iterator();

      Shape var2;
      do {
         if (!var1.hasNext()) {
            return false;
         }

         var2 = (Shape)var1.next();
      } while(var2.getMsoDrawingType() != 19);

      return true;
   }

   void l() {
      Object var1 = null;
      ShapeCollection var2 = this;

      for(int var3 = 0; var3 < var2.getCount(); ++var3) {
         Shape var4 = var2.get(var3);
         if (var4.h != null && !"".equals(var4.h) && var4.O() != null) {
            var4.O().a(this.b, this.c, var4.h);
         }

         byte[] var8;
         switch(var4.getMsoDrawingType()) {
         case 5:
            Chart var5 = ((ChartShape)var4).a();
            var5.G();
            break;
         case 18:
            var8 = var4.X();
            if (var8 != null) {
               var4.c(zcr.a(var8, 0));
            }

            ListBox var7 = (ListBox)var4;
            var8 = var7.Z();
            if (var8 != null) {
               var7.e(zcr.a(var8, 0));
            }
            break;
         case 20:
            var8 = var4.X();
            if (var8 != null) {
               var4.c(zcr.a(var8, 0));
            }

            ComboBox var6 = (ComboBox)var4;
            var8 = var6.Z();
            if (var8 != null) {
               var6.e(zcr.a(var8, 0));
            }
            break;
         default:
            var8 = var4.X();
            if (var8 != null) {
               var4.c(zcr.a(var8, 0));
            }
         }
      }

   }

   void m() {
      Object var1 = null;
      ShapeCollection var2 = this;

      for(int var3 = 0; var3 < var2.getCount(); ++var3) {
         Shape var4 = var2.get(var3);
         var4.C();
         switch(var4.getMsoDrawingType()) {
         case 5:
            Chart var5 = ((ChartShape)var4).a();
            var5.F();
            break;
         default:
            byte[] var6 = var4.X();
            if (var6 != null) {
               var4.c(zcq.a(var6, 0, 0, 0, false));
            }

            var6 = var4.Z();
            if (var6 != null) {
               var4.e(zcq.a(var6, 0, 0, 0, false));
            }
         }
      }

   }

   Shape a(int var1, int var2) {
      Object var3;
      var3 = null;
      label42:
      switch(var1) {
      case 0:
         var3 = new GroupShape(this);
         break;
      case 1:
         var3 = new LineShape(this);
         break;
      case 2:
         var3 = new RectangleShape(this);
         break;
      case 3:
         var3 = new Oval(this);
         break;
      case 4:
         var3 = new ArcShape(this);
         break;
      case 5:
         Chart var6 = new Chart(this.j());
         var3 = var6.getChartObject();
         if (!this.f()) {
            this.c.getCharts().a(var6);
         }
         break;
      case 6:
         var3 = new TextBox(this);
         if (!this.f()) {
            this.j().getTextBoxes().a((TextBox)var3);
         }
         break;
      case 7:
         var3 = new Button(this);
         break;
      case 8:
         Picture var5 = new Picture(this);
         var3 = var5;
         if (!this.f()) {
            this.c.getPictures().a(var5);
         }
         break;
      case 9:
      case 10:
      case 13:
      case 15:
      case 21:
      case 22:
      case 23:
      default:
         if (var2 != 4095) {
            switch(var2) {
            case 1:
               var3 = new RectangleShape(this);
               break label42;
            case 3:
               var3 = new Oval(this);
               break label42;
            case 19:
               var3 = new ArcShape(this);
               break label42;
            case 20:
               var3 = new LineShape(this);
               break label42;
            default:
               var3 = new CellsDrawing(this, var2);
            }
         } else {
            var3 = new CellsDrawing(this, var2);
         }
         break;
      case 11:
         var3 = new CheckBox(this);
         if (!this.f()) {
            this.j().getCheckBoxes().a((CheckBox)var3);
         }
         break;
      case 12:
         var3 = new RadioButton(this);
         break;
      case 14:
         var3 = new Label(this);
         break;
      case 16:
         var3 = new Spinner(this);
         break;
      case 17:
         var3 = new ScrollBar(this);
         break;
      case 18:
         var3 = new ListBox(this);
         break;
      case 19:
         var3 = new GroupBox(this);
         break;
      case 20:
         var3 = new ComboBox(this);
         break;
      case 24:
         OleObject var4 = new OleObject(this);
         var3 = var4;
         ++this.i().c;
         var4.e(this.i().c);
         this.c.getOleObjects().a(var4);
      }

      this.c((Shape)var3);
      return (Shape)var3;
   }
}
